翻訳と辞書
Words near each other
・ Overlap
・ Overlap (railway signalling)
・ Overlap (term rewriting)
・ Overlap coefficient
・ Overlap extension polymerase chain reaction
・ Overlap syndrome
・ Overlap zone
・ Overlapped I/O
・ Overlapping consensus
・ Overlapping distribution method
・ Overlapping gene
・ Overlapping generations
・ Overlapping generations model
・ Overlapping interval topology
・ Overlapping markup
Overlapping subproblems
・ Overlap–add method
・ Overlap–save method
・ Overlawyered
・ Overlay
・ Overlay (poker)
・ Overlay (programming)
・ Overlay architecture
・ Overlay assay
・ Overlay Control
・ Overlay journal
・ Overlay keyboard
・ Overlay multicast
・ Overlay network
・ Overlay plan


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Overlapping subproblems : ウィキペディア英語版
Overlapping subproblems
In computer science, a problem is said to have overlapping subproblems if the problem can be broken down into subproblems which are reused several times or a recursive algorithm for the problem solves the same subproblem over and over rather than always generating new subproblems.〔(Introduction to Algorithms ), 2nd ed., (Cormen, Leiserson, Rivest, and Stein) 2001, p. 327. ISBN 0-262-03293-7.〕〔(Introduction to Algorithms ), 3rd ed., (Cormen, Leiserson, Rivest, and Stein) 2014, p. 384. ISBN 9780262033848.〕
〔(Dynamic Programming: Overlapping Subproblems, Optimal Substructure ), MIT Video.〕
For example, the problem of computing the Fibonacci sequence exhibits overlapping subproblems. The problem of computing the ''n''th Fibonacci number ''F''(''n''), can be broken down into the subproblems of computing ''F''(''n'' − 1) and ''F''(''n'' − 2), and then adding the two. The subproblem of computing ''F''(''n'' − 1) can itself be broken down into a subproblem that involves computing ''F''(''n'' − 2). Therefore the computation of ''F''(''n'' − 2) is reused, and the Fibonacci sequence thus exhibits overlapping subproblems.
A naive recursive approach to such a problem generally fails due to an exponential complexity. If the problem also shares an optimal substructure property, dynamic programming is a good way to work it out.
==Fibonacci Sequence Example in C==

Consider the following C code:
#include
#define N 5
static int fibMem();
int fibonacci(int n)
void printFibonacci()
int main(void)
/
* Output:
fibonacci(1): 1
fibonacci(2): 1
fibonacci(3): 2
fibonacci(4): 3
fibonacci(5): 5
*/
When executed, the fibonacci function computes the value of some of the numbers in the sequence many times over, following a pattern which can be visualized by this diagram:
f(5) = f(4) + f(3) = 5
| |
| f(3) = f(2) + f(1) = 2
| | |
| | f(1) = 1
| |
| f(2) = 1
|
f(4) = f(3) + f(2) = 3
| |
| f(2) = 1
|
f(3) = f(2) + f(1) = 2
| |
| f(1) = 1
|
f(2) = 1
However, we can take advantage of memoization and change the fibonacci function to make use of fibMem like so:
int fibonacci(int n)

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Overlapping subproblems」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.